package com.kevin.actoviti.day02;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.HashMap;
import java.util.Map;

/**
 * @Classname AssigneeUEL
 * @Description 启动流程实例，动态设置assignee
 * @Date 2020/6/23 0:09
 * @Created by kevin
 */
public class AssigneeUEL {

    public static void main(String[] args) {

        //获取流程引擎对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //获取运行时service
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //设置assignee的值
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("assignee0", "zhangsan");
        map.put("assignee1", "lisi");
        map.put("assignee2", "wangwu");

        //启动流程
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday1", map);

        System.out.println(processInstance.getName());

    }
}
